<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">

<ui:composition template="/templates/GeneralTemplate.xhtml">
	<ui:define name="content">
		<h:outputText id="info" value="&nbsp;" />
		<h:message for="info" class="success" />
		<h:form id="userForm">
			<h:panelGrid columns="3"
				rowClasses="jsfcrud_odd_row,jsfcrud_even_row">
				<h:outputText value="#{label.email}:" />
				<h:outputLabel id="email" value="#{gamer.email}" />
				<h:message for="email" class="error" />

				<h:outputText value="#{label.currentPassword}:" />
				<h:inputSecret id="currentPassword" value="#{gamer.currentPassword}" />
				<h:message for="currentPassword" class="error" />

				<h:outputText value="#{label.newPassword}:" />
				<h:inputSecret id="newPassword" value="#{gamer.newPassword}" />
				<h:message for="newPassword" class="error" />

				<h:outputText value="#{label.confirmNewPassword}:" />
				<h:inputSecret id="passwordRepeat" value="#{gamer.passwordRepeat}" />
				<h:message for="passwordRepeat" class="error" />

				<h:outputText value="#{label.name}:" />
				<h:inputText id="name" required="true" value="#{gamer.name}" />
				<h:message for="name" class="error" />

				<h:outputText value="#{label.surname}:" />
				<h:inputText id="surname" value="#{gamer.surname}" />
				<h:message for="surname" class="error" />

				<h:outputText value="#{label.nationality}:" />
				<h:inputText id="nationality" value="#{gamer.nationality}" />
				<h:message for="nationality" class="error" />

				<h:outputText value="#{label.dateOfBirth}:" />
				<h:panelGroup id="dateOfBirth">
					<h:selectOneMenu value="#{gamer.day}">
						<f:selectItem itemLabel="#{label.day}" itemValue="#{null}" />
						<f:selectItems value="#{gamer.days}" />
					</h:selectOneMenu>
					<h:selectOneMenu value="#{gamer.month}">
						<f:selectItem itemLabel="#{label.month}" itemValue="#{null}" />
						<f:selectItems value="#{gamer.months}" />
					</h:selectOneMenu>
					<h:selectOneMenu value="#{gamer.year}">
						<f:selectItem itemLabel="#{label.year}" itemValue="#{null}" />
						<f:selectItems value="#{gamer.years}" />
					</h:selectOneMenu>
				</h:panelGroup>
				<h:message for="dateOfBirth" class="error" />

				<h:outputText value="#{label.country}:" />
				<h:selectOneMenu id="country" value="#{gamer.country}"
					converter="#{countryConverter}"
					valueChangeListener="#{gamer.countryChanged}">
					<f:selectItem itemLabel="#{label.pleaseSelect}" itemValue="#{null}" />
					<f:selectItems value="#{staticValues.countries}" />
					<f:ajax render="city" execute="@this" event="valueChange" />
				</h:selectOneMenu>
				<h:message for="country" class="error" />

				<h:outputText value="#{label.city}:" />
				<h:selectOneMenu id="city" value="#{gamer.city}"
					converter="#{cityConverter}">
					<f:selectItem itemLabel="#{label.pleaseSelect}" itemValue="#{null}" />
					<f:selectItems value="#{gamer.cities}" />
				</h:selectOneMenu>
				<h:message for="city" class="error" />

				<h:outputText value="#{label.language}:" />
				<h:selectOneMenu id="language" value="#{gamer.language}"
					converter="#{languageConverter}">
					<f:selectItems value="#{staticValues.languages}" />
				</h:selectOneMenu>
				<h:message for="language" class="error" />

				<h:outputText value="#{label.games}:"
					styleClass="verticalAlignedText" />
				<h:panelGroup>
					<h:selectOneListbox id="games" value="#{gamer.removedGame}"
						converter="#{gameConverter}" size="5">
						<f:selectItems value="#{gamer.games}" />
					</h:selectOneListbox>
					<h:commandLink value="#{label.remove}"
						styleClass="verticalAlignedText"
						rendered="#{not empty gamer.games}">
						<f:ajax render="games" execute="games"
							listener="#{gamer.removeGame}" />
					</h:commandLink>
				</h:panelGroup>
				<h:message for="games" class="error" />

				<h:outputText value="#{label.addGame}:"
					styleClass="verticalAlignedText" />
				<h:panelGroup>
					<h:selectOneListbox id="availableGames" value="#{gamer.newGame}"
						converter="#{gameConverter}" size="3">
						<f:selectItems value="#{staticValues.games}" />
					</h:selectOneListbox>
					<h:commandLink value="#{label.add}"
						styleClass="verticalAlignedText">
						<f:ajax render="games" execute="availableGames"
							listener="#{gamer.addGame}" />
					</h:commandLink>
				</h:panelGroup>
				<h:message for="availableGames" class="error" />

				<h:outputText value="&nbsp;" />
				<h:commandLink value="#{label.update}" class="button-link"
					action="#{gamer.updateGamer}" />
			</h:panelGrid>
		</h:form>
		<h:outputText value="&nbsp;" />
	</ui:define>
</ui:composition>
</html>